package com.liuceng.zen.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liuceng.zen.mapper.GdtCampaignMapper;
import com.liuceng.zen.pojo.domain.GdtCampaign;

@Service
public class GdtCampaignService extends BaseService<GdtCampaign> {
  @Autowired
  GdtCampaignMapper gdtCampaignMapper;

  public GdtCampaign findByCid(Long cid) {
    return gdtCampaignMapper.findByCid(cid);
  }

  public Integer updateByUid(Map<String, Object> params) {
    return gdtCampaignMapper.updateByUid(params);
  }

  public List<GdtCampaign> findByMemberId(Integer memberId ){
	  
	  return gdtCampaignMapper.findbyMemberId(memberId);
  }
  
  public Integer countByMemberId(Integer memberId) {
    return gdtCampaignMapper.countByMemberId(memberId);
  }

  public GdtCampaign selectAdGroupByMemberId(Integer memberId) {
    GdtCampaign campaign = gdtCampaignMapper.selectCampaignByMemberId(memberId);
      if(campaign==null){
        return new GdtCampaign();
      }
    return campaign;
  }
}
